package com.region.common.adapter.json.convert;

import java.lang.reflect.Type;

/**
 * The json object convert to target object
 *
 * @author liujieyu
 * @date 2023/5/28 14:26
 * @desciption
 */
public interface JsonConvertor {

    /**
     * Is it possible convert to String from Object
     *
     * @param data
     * @return
     */
    boolean isSerialized(Object data);

    /**
     * convert to string object
     *
     * @param data
     * @return
     */
    String convertToString(Object data);

    /**
     *
     * Is it possible convert to Object from String
     * @return
     */
    <T> boolean isDeserialized(String json, Type type);

    /**
     * convert to object by class
     *
     * @param json
     * @param type
     * @param <T>
     * @return
     */
    <T> T convertToObject(String json, Type type);

}
